<html class="hb-loaded">
 <head> 
  <meta content="text/html;charset=utf-8" http-equiv="Content-Type" /> 
  <meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport" /> 
  <meta content="yes" name="apple-mobile-web-app-capable" /> 
  <meta content="black" name="apple-mobile-web-app-status-bar-style" /> 
  <title>个人中心 - 修改密码</title> 
  <link rel="stylesheet" href="css/bootstrap.min.css" /> 
  <link rel="stylesheet" href="css/public.css" /> 
 
  <script src="js/jquery.min.js"></script> 
  <script src="js/ygop.ajax.client.js"></script> 
  <script src="js/bootstrap.min.js"></script> 
  <link rel="stylesheet" href="css/layer.css" /> 
  <script src="js/layer.m.js"></script> 
  <script src="js/Common.js"></script> 




 </head> 
 <body> 
  <link rel="stylesheet" href="css/login.css?v20150819" /> 
  <div class="wrap"> 
   <form> 
    <div class="input-item"> 
     <div class="input-item-list"> 
      <input type="password" placeholder="原密码" id="txtOldPwd" /> 
     </div> 
     <div class="input-item-list"> 
      <input type="password" placeholder="新密码" id="txtPwd" /> 
     </div> 
     <div class="input-item-list"> 
      <input type="password" placeholder="请再次输入新密码" id="txtRepeatPwd" /> 
     </div> 
    </div> 
    <div class="btn-login clearfix"> 
     <button onclick="goBack()" type="button" class="btn_white myleft">返回</button> 
     <button class="btn_green myright" type="button" id="btnSubmit">确认修改</button> 
    </div> 
   </form> 
  </div> 
  <script type="text/javascript">
    $(document).ready(function () {
        $("#btnSubmit").click(function () {
            var oldPwd = $.trim($("#txtOldPwd").val());
            if (oldPwd == "") {
                YgmJsCommon.popups.alert("原密码不能为空！", function () {
                    $("#txtPwd").focus();
                });
                return;
            }
            var pwd = $.trim($("#txtPwd").val());
            if (pwd == "") {
                YgmJsCommon.popups.alert("新密码不能为空！", function () {
                    $("#txtPwd").focus();
                });
                return;
            }

            if (pwd.length < 6 || pwd.length > 16)
            {
                YgmJsCommon.popups.alert("密码应为6-16个英文字母、数字符号！", function () {
                    $("#txtPwd").focus();
                });
                return;
            }

            var retpwd = $.trim($("#txtRepeatPwd").val());
            if (retpwd == "") {
                YgmJsCommon.popups.alert("重复密码不能为空！", function () {
                    $("#txtRepeatPwd").focus();
                });
                return;
            }
            if (pwd != retpwd) {
                YgmJsCommon.popups.alert("两次输入密码不相同！", function () {
                    $("#txtRetPwd").focus();
                });
                return;
            }

            var user = {};
            user.OldPwd = oldPwd;
            user.Pwd = pwd;
            user.RepeatPwd = retpwd;
            $("#btnSubmit").text("正在处理中..").attr("disabled", "disabled");
            ygopAjaxClient.async("/Account/UpdatePwd", "post", user, function (e) {
                $("#btnSubmit").text("确认修改").removeAttr("disabled");
                var rspcode = e.RspCode;
                if (rspcode == 1) {
                    dplus.track("修改密码");
                    YgmJsCommon.popups.alert(e.RspMsg);
                    history.back();
                }
                else {
                    YgmJsCommon.popups.alert(e.RspMsg);
                }
            });
        });
    });

    function goBack() {
        history.go(-1);
    }
</script> 
 </body>
</html>